package com.ruoyi.biz.util;

import java.util.Objects;

/**
 * 激活码等级
 *
 * @author yusheng.liu
 * @since 2025/11/10 11:49
 */
public enum CodeLevel {

    NEVER(0, "永久"),
    MONTH(1, "月度"),

    THREE_MONTH(2, "季度"),

    YEAR(3, "年度");

    CodeLevel(int level, String desc) {
        this.level = level;
        this.desc = desc;
    }


    private final Integer level;

    private final String desc;

    public Integer getLevel() {
        return level;
    }

    public String getDesc() {
        return desc;
    }

    public static CodeExpireEnum getExpire(Integer level) {
        switch (level) {
            case 0:
                return CodeExpireEnum.getBy(-1);
            case 1:
                return CodeExpireEnum.getBy(30);
            case 2:
                return CodeExpireEnum.getBy(90);
            case 3:
                return CodeExpireEnum.getBy(365);
        }

        return null;
    }
}
